<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .baba {
            width: 500px;
            height: 500px;
            background-color: yellowgreen;
        }
        
        .uncle {
            width: 500px;
            height: 500px;
            background-color: blueviolet;
        }
        
        .son {
            width: 300px;
            height: 300px;
            background-color: salmon;
        }
        
        .son1 {
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>

<body>
    <div class="baba">
        <div class="son"></div>
        <div class="son1"></div>
    </div>
    <div class="uncle"></div>
    <a href="http://www.baidu.com">ssss</a>
    <script>
        let baba = document.querySelector('.baba');
        let uncle = document.querySelector('.uncle');
        let son = document.querySelector('.son');
        let son1 = document.querySelector('.son1');

        baba.addEventListener('click', function() {
            alert('bababa');
        });
        son.addEventListener('click', function(e) {
            e.stopPropagation(); // 阻止冒泡
            // e.preventDefault(); // 组织默认事件
            alert('son');
        });
        son1.addEventListener('click', function() {
            alert('son1');
        });
        uncle.addEventListener('click', function() {
            alert('uncle');
        });
        document.addEventListener('click', function() {
            alert('zc');
        });

        let a = document.querySelector('a');
        a.addEventListener('click', function(e) {
            e.preventDefault();
            console.log(1111);
        })
    </script>
</body>

</html>